package model

// User represents the users table
type User struct {
	BaseModel
	Number   string    `gorm:"column:number;NOT NULL;unique" json:"number"`
	Name     string    `gorm:"column:name;NOT NULL" json:"name"`
	Password string    `gorm:"column:password;NOT NULL" json:"password"`
	IsVIP    bool      `gorm:"column:isVIP;NOT NULL" json:"is_vip"`
	IsAdmin  bool      `gorm:"column:isAdmin;NOT NULL" json:"is_admin"`
	Order    []Order   `gorm:"foreignKey:UserID" json:"orders"`
	Cart     []Cart    `gorm:"foreignKey:UserID" json:"carts"`
	Comment  []Comment `gorm:"foreignKey:UserID" json:"comments"`
}

// TableName sets the insert table name for this struct type
func (u *User) TableName() string {
	return "users"
}
